package self.hoy.demo.grainmall.coupon.xpt;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import self.hoy.demo.common.exception.BizCodeEnum;
import self.hoy.demo.common.utils.R;

/**
 * @author hyh
 * @date 2020/7/18
 */
@Slf4j
@RestControllerAdvice
public class ControllerAdvice {
    @ExceptionHandler(value = Exception.class)
    public R handler(Exception e) {
        log.error("error in coupon server", e);
        return R.error(BizCodeEnum.UNKNOWN.getCode(), BizCodeEnum.UNKNOWN.getMsg());
    }
}
